﻿// Copyright: 2012
// Author: Minh Vu - YoungJ
// File: Extension.cs - PhoneAppRssReader - PhoneAppRssReader
// Time: 10:16 PM 04/18/2012

using System.Net;
using System.Xml.Linq;

namespace PhoneAppRssReader.Utls
{
    public static class Extension
    {
        public static string getValue(this XElement element, string attributeName)
        {
            var xElement = element.Attribute(attributeName);
            return xElement != null ? xElement.Value : string.Empty;
        }

        public static string UrlEncode(this string url)
        {
            return HttpUtility.UrlEncode(url);
        }
        public static string UrlDecode(this string url)
        {
            return HttpUtility.UrlDecode(url);
        }
    }
}